<%
request.headers['REQUEST_URI'] = "" if request.headers['REQUEST_URI'].nil?
realUrl = request.original_url
if   (realUrl.match(/forge\.trustie\.net\/*/))
  @nav_dispaly_project_label = 1
  @nav_dispaly_forum_label = 1
elsif (realUrl.match(/course\.trustie\.net\/*/))
  @nav_dispaly_course_all_label = 1
  @nav_dispaly_forum_label = 1
  @nav_dispaly_course_label = nil
  @nav_dispaly_store_all_label = 1
elsif (realUrl.match(/user\.trustie\.net\/*/))
  @nav_dispaly_home_path_label = 1
  @nav_dispaly_main_course_label = 1		
  @nav_dispaly_main_project_label = 1
  @nav_dispaly_main_contest_label = 1
elsif (realUrl.match(/contest\.trustie\.net\/*/))
  @nav_dispaly_contest_label = 1
  @nav_dispaly_store_all_label = 1
else
  @nav_dispaly_project_all_label = 1
  @nav_dispaly_course_all_label = 1
  @nav_dispaly_forum_label = 1
  @nav_dispaly_bid_label = 1
  @nav_dispaly_contest_label = 1
  @nav_dispaly_store_all_label = 1
end
%>

<div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
  <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <%=link_to image_tag("/images/logo5.png", class: 'navbar-brand', style:"width: 50px; height: 50px; padding:4px"), '/' %>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
       <%= bootstrap_render_dynamic_nav if User.current.logged? || !Setting.login_required? -%>
       <li class="dropdown hidden">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
        <ul class="dropdown-menu">
          <li><a href="#">Action</a></li>
          <li><a href="#">Another action</a></li>
          <li><a href="#">Something else here</a></li>
          <li class="divider"></li>
          <li><a href="#">Separated link</a></li>
          <li class="divider"></li>
          <li><a href="#">One more separated link</a></li>
        </ul>
      </li>
    </ul>
    <form class="navbar-form navbar-left hidden" role="search">
      <div class="form-group">
        <input type="text" class="form-control" placeholder="Search">
      </div>
      <button type="submit" class="btn btn-default">Submit</button>
    </form>
    <ul class="nav navbar-nav navbar-right">
      <li class="dropdown <%= "hidden" unless User.current.logged? %>">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=User.current%> <b class="caret"></b></a>
        <ul class="dropdown-menu">
        	<li>
        		<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain }, {:class => 'my-message'} if User.current.logged? -%></li>
           <li><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %></li>
           <li><%=link_to l(:label_my_projects),{:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %></li>
           <li class="divider"></li>
           <li><%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%></li>
         </ul>
       </li>
       <%= bootstrap_render_menu :account_menu -%>
     </ul>
   </div>
  </div>
</div>


<!-- ajax user trace zhangxunhui begin -->
<script type="text/javascript">
	function user_trace_click_project_list(session_id){
    	$.ajax({
			contentType: "application/json; charset=utf-8",
			timeout: 5000,
			url: '/user_traces/click_project_list?session_id=' + session_id,
			dataType: "json"
		});
    }
</script>
<!-- ajax user trace zhangxunhui end -->
